home *** CD-ROM | disk | FTP | other *** search
- '**************************************************************************
- '* Mosby Setup
- '**************************************************************************
-
- '$DEFINE DEBUG ''Define for script development/debugging
-
- '$INCLUDE 'setupapi.inc'
- '$INCLUDE 'msdetect.inc'
-
- ''Dialog ID's
- CONST ASKQUIT = 200
- CONST DESTPATH = 300
- CONST EXITFAILURE = 400
- CONST EXITQUIT = 600
- CONST EXITSUCCESS = 700
- CONST OPTIONS = 800
- CONST APPHELP = 900
- CONST CUSTINST = 6200
- CONST TOOBIG = 6300
- CONST BADPATH = 6400
-
- ''Bitmap ID
- 'CONST LOGO = 1
-
- ''File Types
- CONST APPFILES = 1
- CONST OPTFILES1 = 2
-
-
- '' Font setup
- CONST WM_FONTCHANGE = 29
- CONST HWND_BROADCAST = -1
-
- DECLARE FUNCTION CreateScalableFontResource LIB "GDI.EXE" (fHidden%, FOTFile$, TTFFile$, SysDir$) AS INTEGER
- DECLARE FUNCTION AddFontResource LIB "GDI.EXE" (FOTFiles$) AS INTEGER
- DECLARE FUNCTION SendMessage LIB "USER.EXE" (hWnd%, Message%, wParam%, lParam&) AS LONG
-
-
- GLOBAL DEST$ ''Default destination directory.
- GLOBAL SRCDRV$ ''Source drive.
- GLOBAL TESTDIR$
- GLOBAL WINDRIVE$ ''Windows drive letter.
- GLOBAL OPT1OPT$ ''Option selection from OptFiles1 option dialog.
-
- GLOBAL WINDIR$
-
- ''CustInst list symbol names
- GLOBAL APPNEEDS$ ''Option list costs per drive
- GLOBAL OPT1NEEDS$
-
- GLOBAL EXTRACOSTS$ ''List of extra costs to add per drive
- GLOBAL BIGLIST$ ''List of option files cost calc results (boolean)
- GLOBAL DRVLIST$
-
- ''Dialog list symbol names
- GLOBAL CHECKSTATES$
- GLOBAL STATUSTEXT$
- GLOBAL DRIVETEXT$
-
-
- DECLARE SUB AddOptFilesToCopyList (ftype%)
- DECLARE SUB RecalcOptFiles (ftype%)
- DECLARE SUB RecalcPath
- DECLARE SUB SetDriveStatus
- DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
- WinDir$ = getWindowsDir()
-
- INIT:
- CUIDLL$ = "mscuistf.dll" ''custom user interface dll
- HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
- DRVLIST$ = "DrvList"
- ' SetBitmap CUIDLL$, LOGO
- SetTitle "Mosby Medical Encyclopedia"
-
- szInf$ = GetSymbolValue("STF_SRCINFPATH")
- IF szInf$ = "" THEN
- szInf$ = GetSymbolValue("STF_CWDDIR") + "MOSBY.INF"
- END IF
- ReadInfFile szInf$
-
- WINDRIVE$ = MID$(GetWindowsDir, 1, 1)
-
- DEST$ = WINDRIVE$ + ":\MOSBY"
-
- SRCDRV$ = GetSymbolValue("STF_SRCDIR")
-
- ''CustInst list symbols
- CHECKSTATES$ = "CheckItemsState"
- STATUSTEXT$ = "StatusItemsText"
- DRIVETEXT$ = "DriveStatusText"
- FOR i% = 1 TO 3 STEP 1
- AddListItem CHECKSTATES$, "ON"
- NEXT i%
- FOR i% = 1 TO 3 STEP 1
- AddListItem STATUSTEXT$, ""
- NEXT i%
- FOR i% = 1 TO 7 STEP 1
- AddListItem DRIVETEXT$, ""
- NEXT i%
- ReplaceListItem DRIVETEXT$, 7, DEST$
-
- ''Disk cost list symbols
- APPNEEDS$ = "AppNeeds"
- OPT1NEEDS$ = "Opt1Needs"
- EXTRACOSTS$ = "ExtraCosts"
- BIGLIST$ = "BigList"
- FOR i% = 1 TO 3 STEP 1
- AddListItem BIGLIST$, ""
- NEXT i%
- FOR i% = 1 TO 26 STEP 1
- AddListItem EXTRACOSTS$, "0"
- NEXT i%
-
- ''File Option Variables
- OPT1OPT$ = "1"
- OPT2OPT$ = "1"
-
- RecalcPath
- SetDriveStatus
-
- '$IFDEF DEBUG
- i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
- '$ENDIF ''DEBUG
-
-
-
- CUSTINST:
- sz$ = UIStartDlg(CUIDLL$, CUSTINST, "FCustInstDlgProc", APPHELP, HELPPROC$)
-
- IF sz$ = "CONTINUE" THEN
- ''Install only if it will fit.
- FOR i% = 1 TO 3 STEP 1
- IF GetListItem(BIGLIST$, i%) <> "" THEN
- GOSUB TOOBIG
- GOTO CUSTINST
- END IF
- NEXT i%
- UIPop 1
- GOTO INSTALL
- ELSEIF sz$ = "PATH" THEN
- GOTO GETPATH
- ELSEIF sz$ = "CHK1" THEN
- RecalcOptFiles APPFILES
- SetDriveStatus
- GOTO CUSTINST
- ELSEIF sz$ = "CHK2" THEN
- RecalcOptFiles OPTFILES1
- SetDriveStatus
- GOTO CUSTINST
- ELSEIF sz$ = "BTN2" THEN
- GOTO OPTFILES1
- ELSEIF sz$ = "REACTIVATE" THEN
- RecalcPath
- SetDriveStatus
- GOTO CUSTINST
- ELSE
- GOSUB ASKQUIT
- GOTO CUSTINST
- END IF
-
-
-
- INSTALL:
- ClearCopyList
- AddOptFilesToCopyList APPFILES
- AddOptFilesToCopyList OPTFILES1
- CreateDir DEST$, cmoNone
- CopyFilesInCopyList
-
-
- SYSDIR$=GetWindowsSysDir()
-
-
- IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
- ini$ = MakePath(GetWindowsDir(), "WIN.INI")
- CreateIniKeyValue ini$, "fonts", "Mosby (TrueType)", "MOSBY.FOT", cmoOverwrite
- ini$ = ""
- ini$ = MakePath(GetWindowsDir(), "MOSBY.INI")
- CreateIniKeyValue ini$, "Program", "Path", DEST$, cmoOverwrite
- CreateIniKeyValue ini$, "Table", "Path", SRCDRV$ + "mosby\table", cmoOverwrite
- CreateIniKeyValue ini$, "Appendix", "Path", SRCDRV$ + "mosby\appendix", cmoOverwrite
- CreateIniKeyValue ini$, "Picture", "Path", SRCDRV$ + "mosby\picture", cmoOverwrite
- CreateIniKeyValue ini$, "Media", "Path", SRCDRV$ + "mosby\media", cmoOverwrite
- CreateIniKeyValue ini$, "Atlas", "Path", SRCDRV$ + "mosby\mosbypic\atlas", cmoOverwrite
- CreateIniKeyValue ini$, "ProgramPicture", "Path", SRCDRV$ + "mosby\mosbypic\used", cmoOverwrite
- CreateIniKeyValue ini$, "SidePicture", "Path", SRCDRV$ + "mosby\mosbypic\sidepic", cmoOverwrite
- CreateIniKeyValue ini$, "WordList", "Path", DEST$ + "\wordlist", cmoOverwrite
-
- CreateIniKeyValue ini$, "Sound", "Path", SRCDRV$ + "MOSBY\sound", cmoOverwrite
-
- CreateIniKeyValue ini$, "RDatabase", "Path", SRCDRV$ + "mosby\db", cmoOverwrite
- CreateIniKeyValue ini$, "KeySearch", "Path", SRCDRV$ + "MOSBY\db", cmoOverwrite
-
- CreateIniKeyValue ini$, "HD", "Value", "1", cmoOverwrite
- ini$ = ""
- CreateProgmanGroup "Mosby Multimedia", "", cmoNone
- ShowProgmanGroup "Mosby Multimedia", 1, cmoNone
-
- CreateProgmanItem "Mosby Multimedia", "Mosby Medical Encyclopedia", MakePath(DEST$,"MOSBY.exe"), SRCDRV$ + "SETUP.ICO", cmoOverwrite
- CreateProgmanItem "Mosby Multimedia", "README Encyclopedia Tips", MakePath(GetWindowsDir(),"WRITE.EXE ")+MakePath(DEST$,"ENCYTIPS.WRI"), "", cmoOverwrite
-
- i%=CreateScalableFontResource (0,SYSDIR$+"mosby.fot", "mosby.ttf", SYSDIR$)
- i%=AddFontResource (SYSDIR$+"mosby.fot")
-
- FontName$=STRING$ (64, 32)
- i%=GetTypeFaceNameFromTTF (SYSDIR$+"mosby.ttf", FontName$, 64)
- CreateIniKeyValue "WIN.INI", "fonts", FontName$+" (TrueType)", "mosby.fot", cmoOverwrite
-
- i%=SendMessage (HWND_BROADCAST, WM_FONTCHANGE, 0, 0)
-
-
- END IF
-
- IF GetListItem(CHECKSTATES$, OPTFILES1) = "ON" THEN
- CreateIniKeyValue MakePath(GetWindowsDir(), "WIN.INI"), "mci extensions", "AVI", "AVIVIDEO", cmoAppend
- ini$ = MakePath(GetWindowsDir(), "SYSTEM.INI")
- CreateIniKeyValue ini$, "mci", "AVIVIDEO", "MCIAVI.DRV", cmoOverwrite
- CreateIniKeyValue ini$, "drivers", "vidc.msvc", "msvidc.drv", cmoNone
- CreateIniKeyValue ini$, "drivers", "vidc.rt21", "indeov.drv", cmoNone
- CreateIniKeyValue getWindowsDir() + "system.ini", "Drivers", "VIDC.CVID", "iccvid.drv", cmoOverwrite
- CreateIniKeyValue getWindowsDir() + "system.ini", "Drivers", "VIDC.MSVC", "msvidc.drv", cmoOverwrite
- CreateIniKeyValue getWindowsDir() + "system.ini", "Drivers", "VIDC.IV32", "ir32.dll", cmoOverwrite
- CreateIniKeyValue getWindowsDir() + "system.ini", "Drivers", "VIDC.IV31", "IR32.dll", cmoOverwrite
- CreateIniKeyValue getWindowsDir() + "system.ini", "Drivers", "VIDC.MRLE", "MSRLE.drv", cmoOverwrite
- I% = DoesIniKeyExist (getWindowsDir() + "system.ini", "Drivers", "VIDC.RT21")
- IF I% = 0 THEN
- CreateIniKeyValue getWindowsDir() + "system.ini", "Drivers", "VIDC.RT21", "ir21.dll", cmoOverwrite
- END IF
- CreateIniKeyValue getWindowsDir() + "system.ini", "Drivers", "VIDC.YVU9", "iyvu9.dll", cmoOverwrite
- CreateIniKeyValue "WIN.INI", "mci extensions", "avi", "AVIVideo", cmoOverwrite
- CreateIniKeyValue getWindowsDir() + "system.ini", "mci", "AVIVideo", "mciavi.drv", cmoOverwrite
- CreateIniKeyValue getWindowsDir() + "system.ini", "Drivers", "WaveMapper", "msacm.drv", cmoOverwrite
- CreateIniKeyValue getWindowsDir() + "system.ini", "Drivers", "MSACM.msadpcm", "msadpcm.acm", cmoOverwrite
- CreateIniKeyValue getWindowsDir() + "system.ini", "Drivers", "MSACM.imaadpcm", "imaadpcm.acm", cmoOverwrite
- CreateIniKeyValue getWindowsDir() + "control.ini", "drivers.desc", "msacm.drv", "Microsoft Sound Mapper V2.00", cmoOverwrite
- CreateIniKeyValue getWindowsDir() + "control.ini", "drivers.desc", "msadpcm.acm", "Microsoft ADPCM Codec V2.00", cmoOverwrite
- CreateIniKeyValue getWindowsDir() + "control.ini", "drivers.desc", "imaadpcm.acm", "Microsoft IMA ADPCM Codec V2.00", cmoOverwrite
- ini$ = ""
- run SRCDRV$ + "profdisp.exe"
-
- END IF
-
-
-
- QUIT:
- ON ERROR GOTO ERRQUIT
-
- IF ERR = 0 THEN
- dlg% = EXITSUCCESS
- ELSEIF ERR = STFQUIT THEN
- dlg% = EXITQUIT
- ELSE
- dlg% = EXITFAILURE
- END IF
- QUITL1:
- sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- GOTO QUITL1
- END IF
- UIPop 1
-
- END
-
- ERRQUIT:
- i% = DoMsgBox("Setup sources were corrupted, call xxx-xxxx!", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
- END
-
-
-
- GETPATH:
- SetSymbolValue "EditTextIn", DEST$
- SetSymbolValue "EditFocus", "END"
- GETPATHL1:
- sz$ = UIStartDlg(CUIDLL$, DESTPATH, "FEditDlgProc", APPHELP, HELPPROC$)
-
- IF sz$ = "CONTINUE" THEN
- olddest$ = DEST$
- DEST$ = GetSymbolValue("EditTextOut")
-
- ''Validate new path.
- IF IsDirWritable(DEST$) = 0 THEN
- GOSUB BADPATH
- GOTO GETPATHL1
- END IF
- UIPop 1
-
- ''Truncate display if too long.
- IF LEN(DEST$) > 23 THEN
- ReplaceListItem DRIVETEXT$, 7, MID$(DEST$, 1, 23)+"..."
- ELSE
- ReplaceListItem DRIVETEXT$, 7, DEST$
- END IF
-
- ''Recalc if path changed.
- IF (olddest$ <> DEST$) AND (olddest$ <> DEST$+"\") AND (olddest$+"\" <> DEST$) THEN
- RecalcPath
- SetDriveStatus
- END IF
-
- olddest$ = ""
- GOTO CUSTINST
- ELSEIF sz$ = "REACTIVATE" THEN
- RecalcPath
- SetDriveStatus
- GOTO GETPATHL1
- ELSEIF sz$ = "EXIT" THEN
- GOSUB ASKQUIT
- GOTO GETPATHL1
- ELSE
- UIPop 1
- GOTO CUSTINST
- END IF
-
-
-
- OPTFILES1:
- SetSymbolValue "RadioDefault", OPT1OPT$
-
- TOOBIG:
- sz$ = UIStartDlg(CUIDLL$, TOOBIG, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- RecalcPath
- SetDriveStatus
- GOTO TOOBIG
- END IF
- UIPop 1
- RETURN
-
-
-
- BADPATH:
- sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
- IF sz$ = "REACTIVATE" THEN
- RecalcPath
- SetDriveStatus
- GOTO BADPATH
- END IF
- UIPop 1
- RETURN
-
-
-
- ASKQUIT:
- sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
-
- IF sz$ = "EXIT" THEN
- UIPopAll
- ERROR STFQUIT
- ELSEIF sz$ = "REACTIVATE" THEN
- GOTO ASKQUIT
- ELSE
- UIPop 1
- END IF
- RETURN
-
-
-
- '**
- '** Purpose:
- '** Adds the specified option files to the copy list.
- '** Arguments:
- '** ftype% - type of files to add, one of the following:
- '** ``FILES, OPTFILES1,
- '** Returns:
- '** none.
- '*************************************************************************
- SUB AddOptFilesToCopyList (ftype%) STATIC
-
- IF GetListItem(CHECKSTATES$, ftype%) = "ON" THEN
- SrcDir$ = GetSymbolValue("STF_SRCDIR")
- IF ftype% = APPFILES THEN
- AddSectionFilesToCopyList "AppFiles", SrcDir$, DEST$
- AddSectionFilesToCopyList "AppSysFi", SrcDir$, GetWindowsSysDir()
- AddSectionFilesToCopyList "AppHelpFiles", SrcDir$, DEST$+"\help"
- AddSectionFilesToCopyList "AppDBFiles", SrcDir$, DEST$+"\DB"
- AddSectionFilesToCopyList "AppWordFiles", SrcDir$, DEST$+"\WORDLIST"
- ELSEIF ftype% = OPTFILES1 THEN
- AddSectionFilesToCopyList "VidSysFi", SrcDir$, GetWindowsSysDir()
- END IF
- SrcDir$ = ""
- END IF
- END SUB
-
-
- '**
- '** Purpose:
- '** Recalculates disk space for the given option files and sets
- '** the status info symbol "StatusItemsText".
- '** Arguments:
- '** ftype% - type of files to add, one of the following:
- '** APPFILES, OPTFILES1, OPTFILES2
- '** Returns:
- '** none.
- '*************************************************************************
- SUB RecalcOptFiles (ftype%) STATIC
- CursorSave% = ShowWaitCursor()
- ClearCopyList
- AddOptFilesToCopyList ftype%
-
- fExtra% = 0
- IF ftype% = APPFILES THEN
- ListSym$ = APPNEEDS$
- IF GetListItem(CHECKSTATES$, APPFILES) = "ON" THEN
- ''Add extra cost to Windows drive for ini/progman, etc.
- ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
- ReplaceListItem EXTRACOSTS$, ndrive%, "10240"
- fExtra% = 1
- END IF
- ELSEIF ftype% = OPTFILES1 THEN
- ListSym$ = OPT1NEEDS$
- END IF
-
- StillNeed& = GetCopyListCost(EXTRACOSTS$, ListSym$, "")
-
- cost& = 0
- FOR i% = 1 TO 26 STEP 1
- cost& = cost& + VAL(GetListItem(ListSym$, i%))
- NEXT i%
- ReplaceListItem STATUSTEXT$, ftype%, STR$(cost& / 1024) + " K"
-
- IF StillNeed& > 0 THEN
- ReplaceListItem BIGLIST$, ftype%, "YES"
- ELSE
- ReplaceListItem BIGLIST$, ftype%, ""
- END IF
-
- IF fExtra% THEN
- ReplaceListItem EXTRACOSTS$, ndrive%, "0"
- END IF
- RestoreCursor CursorSave%
- ListSym$ = ""
- END SUB
-
-
- '**
- '** Purpose:
- '** Recalculates disk space and sets option status info according
- '** to the current destination path.
- '** Arguments:
- '** none.
- '** Returns:
- '** none.
- '*************************************************************************
- SUB RecalcPath STATIC
-
- CursorSave% = ShowWaitCursor()
-
- RecalcOptFiles APPFILES
- RecalcOptFiles OPTFILES1
-
- RestoreCursor CursorSave%
- END SUB
-
-
- '**
- '** Purpose:
- '** Sets drive status info according to latest disk space calcs.
- '** Arguments:
- '** none.
- '** Returns:
- '** none.
- '*************************************************************************
- SUB SetDriveStatus STATIC
-
- drive$ = MID$(DEST$, 1, 1)
- ndrive% = ASC(ucase$(drive$)) - ASC("A") + 1
- cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%))
- free& = GetFreeSpaceForDrive(drive$)
- ReplaceListItem DRIVETEXT$, 1, drive$ + ":"
- ReplaceListItem DRIVETEXT$, 2, STR$(cost& / 1024) + " K"
- ReplaceListItem DRIVETEXT$, 3, STR$(free& / 1024) + " K"
-
- IF drive$ = WINDRIVE$ THEN
- ReplaceListItem DRIVETEXT$, 4, ""
- ReplaceListItem DRIVETEXT$, 5, ""
- ReplaceListItem DRIVETEXT$, 6, ""
- ELSE
- ndrive% = ASC(ucase$(WINDRIVE$)) - ASC("A") + 1
- cost& = VAL(GetListItem(APPNEEDS$, ndrive%)) + VAL(GetListItem(OPT1NEEDS$, ndrive%))
- IF cost& = 0 THEN
- ReplaceListItem DRIVETEXT$, 4, ""
- ReplaceListItem DRIVETEXT$, 5, ""
- ReplaceListItem DRIVETEXT$, 6, ""
- ELSE
- free& = GetFreeSpaceForDrive(WINDRIVE$)
- ReplaceListItem DRIVETEXT$, 4, WINDRIVE$ + ":"
- ReplaceListItem DRIVETEXT$, 5, STR$(cost& / 1024) + " K"
- ReplaceListItem DRIVETEXT$, 6, STR$(free& / 1024) + " K"
- END IF
- END IF
- END SUB
-
-
- '**
- '** Purpose:
- '** Appends a file name to the end of a directory path,
- '** inserting a backslash character as needed.
- '** Arguments:
- '** szDir$ - full directory path (with optional ending "\")
- '** szFile$ - filename to append to directory
- '** Returns:
- '** Resulting fully qualified path name.
- '*************************************************************************
- FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
- IF szDir$ = "" THEN
- MakePath = szFile$
- ELSEIF szFile$ = "" THEN
- MakePath = szDir$
- ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
- MakePath = szDir$ + szFile$
- ELSE
- MakePath = szDir$ + "\" + szFile$
- END IF
- END FUNCTION
-
-